'\" te
.\"  Copyright (c) 1996, Sun Microsystems, Inc  All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DDI_DEVICE_ZERO 9F "Sep 25, 1996"
.SH NAME
ddi_device_zero \- zero fill the device
.SH SYNOPSIS
.nf
#include <sys/ddi.h>
#include <sys/sunddi.h>



\fBint\fR \fBddi_device_zero\fR(\fBddi_acc_handle_t\fR \fIhandle\fR, \fBcaddr_t\fR \fIdev_addr\fR,
     \fBsize_t\fR \fIbytecount\fR, \fBssize_t\fR \fIdev_advcnt\fR, \fBuint_t\fR \fIdev_datasz\fR);
.fi

.SH INTERFACE LEVEL
illumos DDI specific (illumos DDI).
.SH PARAMETERS
.ne 2
.na
\fB\fIhandle\fR \fR
.ad
.RS 15n
The data access handle returned from setup calls, such as
\fBddi_regs_map_setup\fR(9F).
.RE

.sp
.ne 2
.na
\fB\fIdev_addr\fR \fR
.ad
.RS 15n
Beginning of the device address.
.RE

.sp
.ne 2
.na
\fB\fIbytecount\fR \fR
.ad
.RS 15n
Number of bytes to zero.
.RE

.sp
.ne 2
.na
\fB\fIdev_advcnt\fR \fR
.ad
.RS 15n
Number of  \fIdev_datasz\fR units to advance on every access.
.RE

.sp
.ne 2
.na
\fB\fIdev_datasz\fR \fR
.ad
.RS 15n
The size of each data word. Possible values are defined as:
.sp
.ne 2
.na
\fB\fBDDI_DATA_SZ01_ACC\fR \fR
.ad
.RS 22n
1 byte data size
.RE

.sp
.ne 2
.na
\fB\fBDDI_DATA_SZ02_ACC\fR \fR
.ad
.RS 22n
2 bytes data size
.RE

.sp
.ne 2
.na
\fB\fBDDI_DATA_SZ04_ACC\fR \fR
.ad
.RS 22n
4 bytes data size
.RE

.sp
.ne 2
.na
\fB\fBDDI_DATA_SZ08_ACC\fR \fR
.ad
.RS 22n
8 bytes data size
.RE

.RE

.SH DESCRIPTION
\fBddi_device_zero()\fR function fills the given, \fIbytecount\fR, number of
byte of zeroes to the device register or memory.
.sp
.LP
The  \fIdev_advcnt\fR argument determines the value of the device address,
\fIdev_addr\fR, on each access.  A value of  \fB0\fR will use the same device
address,  \fIdev_addr\fR, on every  access. A positive value increments the
device address in the next access while a negative value decrements the
address. The device address is incremented and decremented in  \fIdev_datasz\fR
units.
.sp
.LP
The \fIdev_datasz\fR argument determines the size of data word on each access.
.SH RETURN VALUES
\fBddi_device_zero()\fR returns:
.sp
.ne 2
.na
\fB\fBDDI_SUCCESS\fR \fR
.ad
.RS 16n
Successfully zeroed the data.
.RE

.sp
.ne 2
.na
\fB\fBDDI_FAILURE\fR \fR
.ad
.RS 16n
The byte count is not a multiple of  \fIdev_datasz\fR.
.RE

.SH CONTEXT
\fBddi_device_zero()\fR can be called from user, kernel, or interrupt context.
.SH SEE ALSO
.BR ddi_regs_map_free (9F),
.BR ddi_regs_map_setup (9F)
.sp
.LP
\fIWriting Device Drivers\fR
